package net.lab1024.sa.admin.module.yitihua.controller;

import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119HouseAddForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119HouseQueryForm;
import net.lab1024.sa.admin.module.yitihua.domain.form.Cfs119HouseUpdateForm;
import net.lab1024.sa.admin.module.yitihua.domain.vo.Cfs119HouseVO;
import net.lab1024.sa.admin.module.yitihua.service.Cfs119HouseService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import cn.dev33.satoken.annotation.SaCheckPermission;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 一体化平台户信息 Controller
 *
 * @Author cfsjiazy
 * @Date 2025-09-12 11:55:01
 * @Copyright  
 */

@RestController
@Tag(name = "一体化平台户信息")
public class Cfs119HouseController {

    @Resource
    private Cfs119HouseService cfs119HouseService;

    @Operation(summary = "分页查询 @author cfsjiazy")
    @PostMapping("/cfs119House/queryPage")
    @SaCheckPermission("cfs119House:query")
    public ResponseDTO<PageResult<Cfs119HouseVO>> queryPage(@RequestBody @Valid Cfs119HouseQueryForm queryForm) {
        return ResponseDTO.ok(cfs119HouseService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author cfsjiazy")
    @PostMapping("/cfs119House/add")
    @SaCheckPermission("cfs119House:add")
    public ResponseDTO<String> add(@RequestBody @Valid Cfs119HouseAddForm addForm) {
        return cfs119HouseService.add(addForm);
    }

    @Operation(summary = "更新 @author cfsjiazy")
    @PostMapping("/cfs119House/update")
    @SaCheckPermission("cfs119House:update")
    public ResponseDTO<String> update(@RequestBody @Valid Cfs119HouseUpdateForm updateForm) {
        return cfs119HouseService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author cfsjiazy")
    @PostMapping("/cfs119House/batchDelete")
    @SaCheckPermission("cfs119House:delete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<String> idList) {
        return cfs119HouseService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author cfsjiazy")
    @GetMapping("/cfs119House/delete/{id}")
    @SaCheckPermission("cfs119House:delete")
    public ResponseDTO<String> batchDelete(@PathVariable String id) {
        return cfs119HouseService.delete(id);
    }
}
